from parse_utils import trans_format
print(trans_format)
import part1
trans = '<TRANS 50 100>'
part1.run(interactive=False, img_path='samples/rome.jpg', trans_str=trans, effect='Translated')
import part1
trans = '<ROT 45 250 250>'
part1.run(interactive=False, img_path='samples/rome.jpg', trans_str=trans, effect='Rotated')
Note the axes values are used to observe new scaling in pixels.
import part1
trans = '<SCALE 5 5>'
part1.run(interactive=False, img_path='samples/rome.jpg', trans_str=trans, effect='Scaled', side_by_side=False)
import part1
trans = '<SCALE 0.2 0.2>'
part1.run(interactive=False, img_path='samples/rome.jpg', trans_str=trans, effect='Scaled', side_by_side=False)
Comments:
Note that the program also supports mixing transformations with the ones in part b (HE, and $n^{th}$ power).
import part1
trans = '''
<TRANS 50 100>
<ROT 45 250 250>
<SCALE 0.5 0.5>
<NTHP 2>
'''
part1.run(interactive=False, img_path='samples/rome.jpg', trans_str=trans, effect='Net Effect', side_by_side=False)
import part1
trans1 = '<NTHP 5>'
part1.run(interactive=False, img_path='samples/rome.jpg', trans_str=trans1)
import part1
trans2 = '<NTHP 0.2>'
part1.run(interactive=False, img_path='samples/rome.jpg', trans_str=trans2)
import part1
trans = '<HE>'
part1.run(interactive=False, img_path='samples/he.jpg', trans_str=trans)
from part2 import part_a
part_a()
from part2 import part_b
part_b()
from part2 import part_c
part_c()
For our example, we use the vertical edge filter:
2D Sobel = $F = \begin{bmatrix} 1 & 0 & -1 \\ 2 & 0 & -2 \\ 1 & 0 & -1 \end{bmatrix}$
1D Decomposition:
$F_1 = \begin{bmatrix} 1 \\ 2 \\ 1 \end{bmatrix}$, $F_2 = \begin{bmatrix} 1 & 0 & -1 \end{bmatrix} \text{ such that } \space F = F_1.F_2$
Below are the results comparison for different filter sizes (2D vs. Separated 1D):
import part3
part3.run()
Comments: